package com.example.homework;

import java.util.Scanner;

public class HomeWork13 {
    public static void main(String[] args) {
        // 需求：商场推出幸运抽奖活动，抽奖规则如下：
        //	(1)键盘录入四位数字(1000-9999的数字),作为顾客的会员卡号
        //	(2)该会员卡号(键盘录入的四位数字)各位数字之和大于20，则为幸运客户
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入四位数字：");
        int VipNumber = sc.nextInt();
        isVipNum(VipNumber);
    }

    public static void isVipNum(int VipNumber) {
        int ge = VipNumber % 10;
        int shi = VipNumber / 10 % 10;
        int bai = VipNumber / 100 % 10;
        int qian = VipNumber / 1000;
        int sum = ge + shi + bai + qian;

        //相加，判断是否大于等于20
        String str = sum >= 20 ? "是幸运客户" : "不是一个幸运客户";
        System.out.println("会员卡号" + VipNumber + "各个位置之和:" + sum);
        System.out.println("会员卡号" + VipNumber + str);
    }
}
